<?php

$username = $_GET['username'];

// create a new instance of Services_JSON
require_once('JSON.php');
$json = new Services_JSON();

$fpURL = 'http://api.seesmic.com/users/'.$username.'.json';
$handle = fopen($fpURL, "r");
while (!feof($handle)) {
$strOutData .= fread($handle, 8192);
}
fclose($handle);
$userData = $json->decode($strOutData);

$twitter		= $userData->twitter_screen_name;
$username		= $userData->username;
$website		= $userData->url;
$description	= $userData->description;
$first_name		= $userData->first_name;
$last_name		= $userData->last_name;
$profile_image	= $userData->url_profile_image;
$location		= $userData->location;

$output = "<table width=\"90%\" border=\"0\" cellpadding=\"0\" cellspacing=\"2\">";
$output .= "<tr>";
$output .= "<td><img src=\"images/alpha.gif\" width=\"1\" height=\"180\" border=\"0\" /></td>";
$output .= "<td width=\"82\" valign=\"top\" align=\"middle\">";
$output .= "<img src=\"".$profile_image."\" width=\"82\" />";
if ($website) {
	$output .= "<br /><br /><span style=\"color:lightgreen;font-size: 75%;font-family: arial, 'lucida console', sans-serif\">";
	$output .= "<a href=\"".$website."\" target=\"_new\">website</a>";
	$output .= "</span>";
}
if ($twitter) {
	$output .= "<br /><br />";
	$output .= "<span style=\"color:cyan;font-size: 75%;font-family: arial, 'lucida console', sans-serif\">";
	$output .= "<a href=\"http://twitter.com/".$twitter."\" target=\"_new\">twitter profile</a>";
	$output .= "</span>";
}
$output .= "</td>";
$output .= "<td valign=\"top\">";
$output .= "<span style=\"color:orange;font-size: 100%;font-family: arial, 'lucida console', sans-serif\">";
$output .= $username;
$output .= "</span>";
if ($first_name) {
	$output .= "<br />";
	$output .= "<span style=\"color:white;font-size: 75%;font-family: arial, 'lucida console', sans-serif\">";
	$output .= $first_name;
	$output .= "</span>";
}
if ($last_name) {
	$output .= "&nbsp;";
	$output .= "<span style=\"color:white;font-size: 75%;font-family: arial, 'lucida console', sans-serif\">";
	$output .= $last_name;
	$output .= "</span>";
}
if ($location) {
	$output .= "<br />";
	$output .= "<span style=\"color:grey;font-size: 75%;font-family: arial, 'lucida console', sans-serif\">";
	$output .= $location;
	$output .= "</span>";
}
if ($description) {
	$output .= "<br />";
	$output .= "<span style=\"color:white;font-size: 75%;font-family: arial, 'lucida console', sans-serif\">";
	$output .= $description;
	$output .= "</span>";
}
$output .= "</td></tr>";
$output .= "</table>";

echo $output;

?>